import store from '../store/index.js';
uni.addInterceptor('request',{
	invoke(args) {
		//console.log(args)
		args.header ={
			'X-Litemall-Token' :store.state.vuex_token
		}
		
	
	}
		
})


export function get(url,data=null){
	return new Promise((resolve,reject)=>{
		uni.request({
			url:url,
			data:data,
			method:'GET',
			success(res) {
				resolve(res)
			},
			fail(res) {
				reject(res)
			}
		})
		
	})
}
export function post(url,data=null){
	return new Promise((resolve,reject)=>{
		uni.request({
			url:url,
			data:data,
			method:'POST',
			success(res) {
				resolve(res)
			},
			fail(res) {
				reject(res)
			}
		})
		
	})
}